From 01c1de235d7bdf702f8d1dfc99645b57afe3deec Mon Sep 17 00:00:00 2001
From: Andriy Grytsenko <andrej@rep.kiev.ua>
Date: Sat, 24 Nov 2012 19:34:44 +0200
Subject: [PATCH 21/22] Fix over previous commit: it leaded to crash.

The last fix was incorrect since it updated selection after the
model was actually unset in FmStandardView but still in ExoIconView
therefore it crashed in raised callbacks.
The commit does it simpler by unselecting them all. That will
still send a signal about reset selection but will not conflict.
---
 src/gtk/fm-folder-view.c   | 3 +++
 src/gtk/fm-standard-view.c | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gtk/fm-folder-view.c b/src/gtk/fm-folder-view.c
index d7fa53e..240f0e3 100644
--- a/src/gtk/fm-folder-view.c
+++ b/src/gtk/fm-folder-view.c
@@ -624,6 +624,9 @@ void fm_folder_view_set_model(FmFolderView* fv, FmFolderModel* model)
     {
         fm_folder_model_get_sort(old_model, &by, &mode);
         unset_model(fv, old_model);
+        /* https://bugs.launchpad.net/ubuntu/+source/pcmanfm/+bug/1071231:
+           after changing the folder selection isn't reset */
+        iface->unselect_all(fv);
     }
     /* FIXME: which setting to apply if this is first model? */
     iface->set_model(fv, model);
diff --git a/src/gtk/fm-standard-view.c b/src/gtk/fm-standard-view.c
index 1ff55ae..175cced 100644
--- a/src/gtk/fm-standard-view.c
+++ b/src/gtk/fm-standard-view.c
@@ -275,9 +275,6 @@ static void unset_model(FmStandardView* fv)
         /* g_debug("unset_model: %p, n_ref = %d", model, G_OBJECT(model)->ref_count); */
         g_object_unref(model);
         fv->model = NULL;
-        /* https://bugs.launchpad.net/ubuntu/+source/pcmanfm/+bug/1071231:
-           after changing the folder selection isn't reset */
-        on_sel_changed(NULL, fv);
     }
 }
 
-- 
1.8.0.1

